package com.hnevc.foodserverapi.dao;



import com.hnevc.foodserverapi.pojo.Comments;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface CommentsMapper {
    //所有评论列表接口
    @Select("select * from t_comments")
    List<Comments> queryComment();
    //根据foodid查询评论列表接口
    @Select("select * from t_comments where foodid=#{foodid}")
    List<Comments> queryFoodidDetails(int foodid);
    //发表评论接口
    @Insert("insert into t_comments values (null,#{foodid},#{userid},#{comment},#{postdate})")
    int addComment(Comments comments);
    //根据id查找评论接口
    @Select("select * from t_comments where id=#{id}")
    List<Comments> queryIdDetails(int id);
}
